module.exports = {
	cors(){
		return function(req,res,next){
			res.set("Access-Control-Allow-Origin","*");
			res.set("Access-Control-Allow-Headers","*");
			res.set("Access-Control-Allow-Methods","*");
			next();
		}
	},
	sendJson(){
		return function(req,res,next){
			res.sendJson = function(msg="网络连接错误",ok=-1){
				res.json({
					ok,
					msg
				})
			}
			next();
		}
	}
}